package com.csdj.s3project.controller;


import com.csdj.s3project.common.WebResult;
import com.csdj.s3project.common.WebResultMsgCode;
import com.csdj.s3project.entity.Picture;
import com.csdj.s3project.service.IPictureService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zq
 * @since 2022-01-17
 */
@RestController
@RequestMapping("/picture")
public class PictureController {
    private Logger log = LoggerFactory.getLogger("picturecontroller");
    @Resource
    private IPictureService iPictureService;

    @GetMapping("shouye")
    public WebResult getSelectShouYePicture(){
        List<Picture> plist = iPictureService.selectShouYePicture();
        if(plist == null){
            return new WebResult().putData("picture",null);
        }
        return new WebResult(WebResultMsgCode.SUCCESS).putData("picture",plist);
    }

    @GetMapping("guanggao")
    public WebResult getSelectGuangGaoPicture(){
        List<Picture> plist = iPictureService.selectGuangGaoPicture();
        log.info(plist.toString());
        if(plist == null){
            return new WebResult().putData("picture",null);
        }
        return new WebResult(0).putData("picture",plist);
    }
}
